/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SysAguas.modelo;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Heitor
 */
@Entity
@Table(name="pagamento")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="tipo",length=10,discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue(value="AVISTA")
public /*abstract*/  class Pagamento implements Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    protected Integer id;

    @Column(name="valorPago")
    protected double valorPago;

    @Column(name="valorTotal")
    protected double valorTotal;

    @Column(name="dinheiro")
    protected boolean dinheiro;

    @Column(name="tipo")
    protected String tipo;
    
    @OneToOne(cascade=CascadeType.PERSIST)
    @JoinColumn(name="Reserva_idReserva")
    protected Reserva reservaP;



    public Pagamento() {
    }

    public Reserva getReservaP() {
        return reservaP;
    }

    public void setReservaP(Reserva reservaP) {
        this.reservaP = reservaP;
    }


    public boolean isDinheiro() {
        return dinheiro;
    }

    public void setDinheiro(boolean dinheiro) {
        this.dinheiro = dinheiro;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }



    public double getValorPago() {
        return valorPago;
    }

    public void setValorPago(double valorPago) {
        this.valorPago = valorPago;
    }

    public double getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(double valorTotal) {
        this.valorTotal = valorTotal;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Pagamento other = (Pagamento) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }



}
